package com.intellagric.controller.agritech.controller.user_action;

import com.intellagric.common.pojo.LayuiDataGridResult;
import com.intellagric.common.pojo.ResponseMessage;
import com.intellagric.pojo.AgtUserStar;
import com.intellagric.service.agritech.UserStarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: cwq
 * @Date: 2019/2/28 20:47
 * @Description:
 */
@RequestMapping("/api/agt_user_star")
@Controller
public class UserStarController {

    @Autowired
    private UserStarService userStarService;

    @RequestMapping("/add")
    @ResponseBody
    public ResponseMessage add(AgtUserStar userStar) {
        return userStarService.addUserStar(userStar);
    }

    @RequestMapping("/like")
    public ResponseMessage like(AgtUserStar agtUserStar) {
        return userStarService.cancelUserStar(agtUserStar);
    }

/*    @RequestMapping("/cancel")
    public ResponseMessage cancel(AgtUserStar agtUserStar) {
        return userStarService.cancelUserStar(agtUserStar);
    }*/

    @RequestMapping("/delete")
    @ResponseBody
    public ResponseMessage delete(String id) {
        return userStarService.deleteUserStar(id);
    }

    @RequestMapping("/edit")
    @ResponseBody
    public ResponseMessage edit(AgtUserStar userStar) {
        return userStarService.editUserStar(userStar);
    }

    @RequestMapping("/{id}")
    @ResponseBody
    public AgtUserStar get(@PathVariable String id) {
        return userStarService.getUserStarById(id);
    }

    @RequestMapping("/list")
    @ResponseBody
    public LayuiDataGridResult getList() {
        return userStarService.getUserStarList();
    }

/*    @RequestMapping("/query")
    @ResponseBody
    public LayuiDataGridResult getListByVo(AgtUserStarVo agtUserStarVo, int page, int limit) {
        return userStarService.getUserStarListByVo(agtUserStarVo, page, limit);
    }*/

    @RequestMapping("/page")
    @ResponseBody
    public LayuiDataGridResult getPage(int page, int limit) {
        return userStarService.getUserStarByPage(page, limit);
    }
}
